//
//  XRmenuHelper.h
//  XRmenu
//
//  Created by yangxh on 11-3-23.
//  Copyright 2011 E0571. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Http.h"
#import "RegexKitLite.h"
#import "JSON.h"
#import "XRmenuError.h"
#import "Business.h"

@class DishLanguageEx;
@class Product;
@interface XRmenuHelper : NSObject {

}

#pragma mark test
+ (void)testHttpsConection;

#pragma mark XRmenu
+ (id)getDataFromInternet:(NSString *)urlAddress Error:(NSError **)outError;
+ (BOOL)reportToCMS:(NSString *)baseUrl UDID:(NSString *)aUDID;
+ (NSString *)sendMyOrders:(NSString *)sendOrderJson Error:(XRmenuError **)outError;

#pragma mark 连接 
//取授权服务器地址
+ (NSString *)centerUrlWithError:(XRmenuError **)outError;

//是否授权
+ (NSString*)getLinsence:(NSString *)centerUrl UUID:(NSString *)uuid Error:(XRmenuError **)outError;

//向center登记硬件信息
+ (BOOL)reportDeviceInfomationToCenter:(NSString *)centerUrl Name:(NSString *)aName Type:(NSInteger)aType 
								 Model:(NSString *)aModel OSVersion:(NSString *)aOSVersion SN:(NSString *)aSN 
								  UDID:(NSString *)aUDID BundleVersion:(NSString *)aBundleVersion TokenKey:(NSString *)aTokenKey
								 Error:(XRmenuError **)outError;

//取餐厅信息
+ (IRestaurant *)restaurantInfoFromCenter:(NSString *)centerUrl UUID:(NSString *)aUUID Error:(XRmenuError **)outError;

//取当前餐厅数据更新地址
+ (NSString *)getUpdateUrl:(NSString *)centerUrl UUID:(NSString *)aUUID Error:(XRmenuError **)outError;

#pragma mark CMS Data
//根据udid取部门编号
+ (IDepartment *)departmentIdWithBaseUrl:(NSString *)baseUrl UUID:(NSString *)uuid Error:(XRmenuError **)outError;

//向CMS报告信息
+ (BOOL)reportToCMS:(NSString *)baseUrl Model:(NSString *)aModel SN:(NSString *)aSN Vsersion:(NSString *)aVersion
					 UDID:(NSString *)aUDID Type:(NSInteger)aType Name:(NSString *)aName Mac:(NSString *)aMac
					   IP:(NSString *)aIpAddress;

//取欢迎页信息
+ (IWelcomePage *)welcomePage:(NSString *)baseUrl UUID:(NSString *)uuid Error:(XRmenuError **)outError;

// 取所有菜本
+ (NSArray *)menuBooksAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

// 根据Menu编号 取  Catalogs
+ (NSArray *)catalogsAll:(NSString *)baseUrl menuId:(NSString *)aMenuId Error:(XRmenuError **)outError;

// 根据 Catalogs 编号 取子 Catalogs
+ (NSArray *)catalogsGetSubCatelogs:(NSString *)baseUrl parentCatalogsId:(NSString *)catalogId Error:(XRmenuError **)outError;

// 根据 Catalogs 编号 取 Product
+ (NSArray *)productAll:(NSString *)baseUrl catalogsId:(NSString *)aCatalogsId Error:(XRmenuError **)outError;

// 取所有的Dish
+ (NSArray *)dishesAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

// 取所有的 Cigarette
+ (NSArray *)cigarettesAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

// 取所有的 Drink
+ (NSArray *)drinksAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

//9.  取所有的 SeasonDish
+ (NSArray *)seasonDishesAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

//10.  取所有的 SetMail
+ (NSArray *)setMealsAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

//11. 根据 SetMail 编号 取 所有的 Product 编号
+ (NSArray *)products:(NSString *)baseUrl bySetMealId:(NSString *)setMealId Error:(XRmenuError **)outError;

//12. 根据 Product 编号 取 所有的  SetMail 编号
+ (NSArray *)setMeals:(NSString *)baseUrl byProductId:(NSString *)productId Error:(XRmenuError **)outError;

//13. 取所有的 标签
+ (NSArray *)productTagsAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

//14. 取所有的 改码
+ (NSArray *)specCodesAll:(NSString *)baseUrl DepartmentId:(NSString *)departmentId Error:(XRmenuError **)outError;

//15. 根据Product  编号取 标签
+ (NSArray *)productTags:(NSString *)baseUrl byProductId:(NSString *)productId Error:(XRmenuError **)outError;

//16. 根据标签编号 取 Product
+ (NSArray *)products:(NSString *)baseUrl byProductTagId:(NSString *)productTagId Error:(XRmenuError **)outError;

//17. 根据 改码编号 取 Product
+ (NSArray *)products:(NSString *)baseUrl bySpecCodeId:(NSString *)specCodeId Error:(XRmenuError **)outError;

//18. 根据 Product 编号 取 改码
+ (NSArray *)specCodes:(NSString *)baseUrl byProductId:(NSString *)productId Error:(XRmenuError **)outError;

// 取 图片/视频等 文件
+ (NSArray *)docFilesAll:(NSString *)baseUrl Error:(XRmenuError **)outError;

+ (BOOL)downloadFile:(NSString *)url LocalFolder:(NSString *)localFolder;

+(DishLanguageEx*)getCurrentEx:(Product*)aProduct;
@end
